<?php 
header("content-type:text/html;charset=utf-8");
date_default_timezone_set('PRC');
class EazyPHP{
	// 运行框架
	static function run()
	{
		define('EAZYPHP_PATH',dirname(__FILE__).'/');
		// 加载核心文件
		self::loadfile();
		self::creatIntiDir();//初始化目录
		//运行应用
		App::run();
	}

	static private function loadfile()
	{
		$files=include EAZYPHP_PATH.'File.php';
		foreach ($files as $f) {
			is_file($f) and require $f;
		}
	}
	static function creatIntiDir()
	{
		// 判断应用文件是否存在
		if (is_dir(APP_PATH))return; 
		$dirs=array(
			APP_PATH,//应用目录
			APP_PATH.'/Index',//模块目录
			APP_PATH.'/Index/Controller',//控制器目录
			APP_PATH.'/Index/Config/',//配置目录
			APP_PATH.'Index/View/Index/',//模板目录
			APP_PATH.'Index/View/Index/Compile',//模板编译目录
			APP_PATH.'Index/View/Public/',//Public目录
			APP_PATH.'Index/View/Public/Compile',//Public编译目录
			);
		foreach ($dirs as $d) {
			is_dir($d) or mkdir($d,0755,true);
		}
		copy(EAZYPHP_PATH.'/Tpl/controller.php',APP_PATH.'/Index/Controller/IndexController.class.php');
		copy(EAZYPHP_PATH.'/Tpl/Login.php',APP_PATH.'/Index/Controller/LoginController.class.php');
		copy(EAZYPHP_PATH.'/Tpl/index.html',APP_PATH.'Index/View/Index/index.html');
		copy(EAZYPHP_PATH.'/Tpl/success.html',APP_PATH.'Index/View/Public/success.html');
		copy(EAZYPHP_PATH.'/Tpl/error.html',APP_PATH.'Index/View/Public/error.html');
		copy(EAZYPHP_PATH.'Config.php', APP_PATH.'/Index/Config/Config.php');
	}

}
// 运行框架
EazyPHP::run();



 ?>